<template>
	<view class="singleImg">
		<view class="flex alignCenter imgBox" v-if="fileUrl">
			<view class="imgItem">
				<image :src="fileUrl" mode=""></image>
				<view class="itemOper flex alignCenter justConAround">
					<uni-icons class="delIcon" color="#fff" type="trash" size="26" @click="delPic"></uni-icons>
					<uni-icons class="bigIcon" color="#fff" type="search" size="26" @click="showBigPic"></uni-icons>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { previewImg} from "@/utils/common.js"
	export default {
		name:"uni-singleimg",
		props:{
			fileUrl:{
				type:String,
				default:''
			}
		},
		data() {
			return {
				
			};
		},
		methods:{
			delPic(){
				this.$emit('delPic')
			},
			// 预览图片
			showBigPic(){
				previewImg([this.fileUrl])
			},
		}
	}
</script>

<style lang="less" scoped>
.imgBox{
	.imgItem{
		position: relative;
		margin-right: 20rpx;
	}
	image{
		width: 200rpx;
		height: 200rpx;
		display: block;
		border-radius: 14rpx;
	}
	.itemOper{
		position: absolute;
		left:0;
		top: 0;
		background: rgba(0, 0, 0, .3);
		width: 100%;
		height: 100%;
		text-align: center;
		line-height: 200rpx;
		border-radius: 14rpx;
		padding:0 30rpx;
		box-sizing: border-box;
	}
}
</style>